<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
			function toggleCodeSection(btn, id)
			{
				area = document.getElementById(id);
				if (area.style.display == 'none')
					{
					btn.innerHTML = '-';
					area.style.display = 'inline';
					}
				else
					{
					btn.innerHTML = '+';
					area.style.display = 'none';
					}
			}
		</script>
<style>
			.SummaryTitle  { }
			.SummaryNumber { background-color:#DDDDDD; text-align: center; }
			.ItemNumber    { background-color: #DDDDDD; }
			.CodeFragment  { background-color: #BBBBBB; display:none; font:normal normal normal 9pt Courier; }
			.ExpandButton  { background-color: #FFFFFF; font-size: 8pt; width: 20px; height: 20px; margin:0px; }
		</style>
</head>
<body>
<h2>Summary of duplicated code</h2>
    This page summarizes the code fragments that have been found to be replicated in the code.
    Only those fragments longer than 30 lines of code are shown.
    <p></p>
<table border="1" class="summary" cellpadding="2">
<tr style="background-color:#CCCCCC;">
<th># duplications</th><th>Total lines</th><th>Total tokens</th><th>Approx # bytes</th>
</tr>
<tr>
<td class="SummaryNumber">2</td><td class="SummaryNumber">186</td><td class="SummaryNumber">1092</td><td class="SummaryNumber">4368</td>
</tr>
</table>
<p></p>
    You expand and collapse the code fragments using the + buttons. You can also navigate to the source code by clicking
    on the file names.
    <p></p>
<table>
<tr style="background-color: #444444; color: #DDDDDD;">
<td>ID</td><td>Files</td><td>Lines</td>
</tr>
<tr>
<td class="ItemNumber">1</td><td>
<table>
<tr>
<td><a href="../src//Users/dyhodge/projects/airlift/src/java/airlift/generator/JavaGenerator.java.html#242">/Users/dyhodge/projects/airlift/src/java/airlift/generator/JavaGenerator.java</a></td><td> line 242</td>
</tr>
<tr>
<td><a href="../src//Users/dyhodge/projects/airlift/src/java/airlift/generator/JavaGenerator.java.html#400">/Users/dyhodge/projects/airlift/src/java/airlift/generator/JavaGenerator.java</a></td><td> line 400</td>
</tr>
</table>
</td><td># lines : 130</td>
</tr>
<tr>
<td></td><td colspan="2" valign="top">
<table>
<tr>
<td valign="top"><button class="ExpandButton" onclick="blur(); toggleCodeSection(this, 'frag_1')">+</button></td><td><textarea cols="100" rows="30" wrap="off" class="CodeFragment" style="display:none;" id="frag_1">

			attributeStringTemplate.setAttribute("scope", "private");
			attributeStringTemplate.setAttribute("type", type);
			attributeStringTemplate.setAttribute("name", name);

			getterStringTemplate.setAttribute("scope", scope);
			getterStringTemplate.setAttribute("type", type);
			getterStringTemplate.setAttribute("getterName", getterName);
			getterStringTemplate.setAttribute("name", name);

			setterStringTemplate.setAttribute("scope", scope);
			setterStringTemplate.setAttribute("type", type);
			setterStringTemplate.setAttribute("setterName", setterName);
			setterStringTemplate.setAttribute("name", name);

			printMessage("Checking is type: " + type);

			if (isArrayType(type) == true)
			{
				stringBufferStringTemplate.setAttribute("getterName", "airlift.util.AirliftUtil.generateStringFromArray(" + getterName + "())");
			}
			else
			{
				stringBufferStringTemplate.setAttribute("getterName", getterName + "()");
			}

			stringBufferStringTemplate.setAttribute("name", name);

		}

		if (_domainObjectModel.isClockable() == true)
		{
			attributeStringTemplate.setAttribute("scope", "private");
			attributeStringTemplate.setAttribute("type", "java.lang.String");
			attributeStringTemplate.setAttribute("name", "source");

			getterStringTemplate.setAttribute("scope", "public");
			getterStringTemplate.setAttribute("type", "java.lang.String");
			getterStringTemplate.setAttribute("getterName", "getSource");
			getterStringTemplate.setAttribute("name", "source");

			setterStringTemplate.setAttribute("scope", "public");
			setterStringTemplate.setAttribute("type", "java.lang.String");
			setterStringTemplate.setAttribute("setterName", "setSource");
			setterStringTemplate.setAttribute("name", "source");

			stringBufferStringTemplate.setAttribute("getterName", "getSource()");
			stringBufferStringTemplate.setAttribute("name", "source");

			attributeStringTemplate.setAttribute("scope", "private");
			attributeStringTemplate.setAttribute("type", "java.lang.Integer");
			attributeStringTemplate.setAttribute("name", "clock");

			getterStringTemplate.setAttribute("scope", "public");
			getterStringTemplate.setAttribute("type", "java.lang.Integer");
			getterStringTemplate.setAttribute("getterName", "getClock");
			getterStringTemplate.setAttribute("name", "clock");

			setterStringTemplate.setAttribute("scope", "public");
			setterStringTemplate.setAttribute("type", "java.lang.Integer");
			setterStringTemplate.setAttribute("setterName", "setClock");
			setterStringTemplate.setAttribute("name", "clock");

			stringBufferStringTemplate.setAttribute("getterName", "getClock()");
			stringBufferStringTemplate.setAttribute("name", "clock");

			attributeStringTemplate.setAttribute("scope", "private");
			attributeStringTemplate.setAttribute("type", "java.lang.String");
			attributeStringTemplate.setAttribute("name", "hash");

			getterStringTemplate.setAttribute("scope", "public");
			getterStringTemplate.setAttribute("type", "java.lang.String");
			getterStringTemplate.setAttribute("getterName", "getHash");
			getterStringTemplate.setAttribute("name", "hash");

			setterStringTemplate.setAttribute("scope", "public");
			setterStringTemplate.setAttribute("type", "java.lang.String");
			setterStringTemplate.setAttribute("setterName", "setHash");
			setterStringTemplate.setAttribute("name", "hash");

			stringBufferStringTemplate.setAttribute("getterName", "getHash()");
			stringBufferStringTemplate.setAttribute("name", "hash");

			attributeStringTemplate.setAttribute("scope", "private");
			attributeStringTemplate.setAttribute("type", "java.util.Date");
			attributeStringTemplate.setAttribute("name", "createDate");

			getterStringTemplate.setAttribute("scope", "public");
			getterStringTemplate.setAttribute("type", "java.util.Date");
			getterStringTemplate.setAttribute("getterName", "getCreateDate");
			getterStringTemplate.setAttribute("name", "createDate");

			setterStringTemplate.setAttribute("scope", "public");
			setterStringTemplate.setAttribute("type", "java.util.Date");
			setterStringTemplate.setAttribute("setterName", "setCreateDate");
			setterStringTemplate.setAttribute("name", "createDate");

			stringBufferStringTemplate.setAttribute("getterName", "getCreateDate()");
			stringBufferStringTemplate.setAttribute("name", "createDate");

			attributeStringTemplate.setAttribute("scope", "private");
			attributeStringTemplate.setAttribute("type", "java.util.Date");
			attributeStringTemplate.setAttribute("name", "updateDate");

			getterStringTemplate.setAttribute("scope", "public");
			getterStringTemplate.setAttribute("type", "java.util.Date");
			getterStringTemplate.setAttribute("getterName", "getUpdateDate");
			getterStringTemplate.setAttribute("name", "updateDate");

			setterStringTemplate.setAttribute("scope", "public");
			setterStringTemplate.setAttribute("type", "java.util.Date");
			setterStringTemplate.setAttribute("setterName", "setUpdateDate");
			setterStringTemplate.setAttribute("name", "updateDate");

			stringBufferStringTemplate.setAttribute("getterName", "getUpdateDate()");
			stringBufferStringTemplate.setAttribute("name", "updateDate");
		}

		domainObjectStringTemplate.setAttribute("attributes", attributeStringTemplate);
		domainObjectStringTemplate.setAttribute("attributeGetters", getterStringTemplate);
		domainObjectStringTemplate.setAttribute("attributeSetters", setterStringTemplate);
		domainObjectStringTemplate.setAttribute("attributeStringBufferAppends", stringBufferStringTemplate);
		domainObjectStringTemplate.setAttribute("generatorComment", comment	);
		domainObjectStringTemplate.setAttribute("package", _domainObjectModel.getRootPackageName());
		domainObjectStringTemplate.setAttribute("fullClassName", _domainObjectModel.getFullyQualifiedClassName());
		domainObjectStringTemplate.setAttribute("className", upperTheFirstCharacter(_domainObjectModel.getClassName()));

		return domainObjectStringTemplate.toString();
	}

	public String generateDao(DomainObjectModel _domainObjectModel)

</textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<hr>
</td>
</tr>
<tr>
<td class="ItemNumber">2</td><td>
<table>
<tr>
<td><a href="../src//Users/dyhodge/projects/airlift/src/java/airlift/generator/JavaGenerator.java.html#538">/Users/dyhodge/projects/airlift/src/java/airlift/generator/JavaGenerator.java</a></td><td> line 538</td>
</tr>
<tr>
<td><a href="../src//Users/dyhodge/projects/airlift/src/java/airlift/generator/JavaScriptGenerator.java.html#58">/Users/dyhodge/projects/airlift/src/java/airlift/generator/JavaScriptGenerator.java</a></td><td> line 58</td>
</tr>
</table>
</td><td># lines : 56</td>
</tr>
<tr>
<td></td><td colspan="2" valign="top">
<table>
<tr>
<td valign="top"><button class="ExpandButton" onclick="blur(); toggleCodeSection(this, 'frag_2')">+</button></td><td><textarea cols="100" rows="30" wrap="off" class="CodeFragment" style="display:none;" id="frag_2">

		java.util.Iterator attributes = _domainObjectModel.getAttributes();

		boolean hasPrimaryKey = false;
		boolean updateIsAvailable = false;

		String isUndoable = "false";

		while (attributes.hasNext() == true)
		{
			String isSearchable = "false";

			Attribute attribute = (Attribute) attributes.next();
			Annotation persist = (Annotation) _domainObjectModel.getAnnotation(attribute,"airlift.generator.Persistable");
			Annotation search = (Annotation) _domainObjectModel.getAnnotation(attribute,"airlift.generator.Searchable");
			Annotation undo = (Annotation) _domainObjectModel.getAnnotation(attribute,"airlift.generator.Undoable");

			isUndoable = (undo != null) ? findValue(undo, "isUndoable()") : "false";

			String requestPersistence = findValue(persist, "isPersistable()");
			String requestSearchable = findValue(persist, "isSearchable()");			

			if ("true".equals(requestPersistence) == true)
			{
				String type = attribute.getType();

				if (isPersistable(type) == false)
				{
					throw new RuntimeException("No persistence support for complex object types like: " + type);
				}

				String fieldName = attribute.getName();
				String name = attribute.getName();
				String isPrimaryKey = findValue(persist, "isPrimaryKey()");
				String rangeable = findValue(persist, "rangeable()");
				String isImmutable = findValue(persist, "immutable()");

				if (search != null)
				{
					isSearchable = findValue(search, "isSearchable()");
				}

				hasPrimaryKey = true;

				StringTemplate daoAttributeStringTemplate = getStringTemplateGroup().getInstanceOf("airlift/dao/DaoAttribute");

				daoAttributeStringTemplate.setAttribute("findByThisAttributeSql", databaseGenerator.generateFindByThisAttributeSql(_domainObjectModel, fieldName));
				daoAttributeStringTemplate.setAttribute("attributeName", name);
				daoAttributeStringTemplate.setAttribute("attributeType", type);
				daoAttributeStringTemplate.setAttribute("uppercaseAttributeName", upperTheFirstCharacter(name));
				daoAttributeStringTemplate.setAttribute("className", upperTheFirstCharacter(_domainObjectModel.getClassName()));
				daoStringTemplate.setAttribute("collectByAttribute", daoAttributeStringTemplate.toString());

				StringTemplate daoRangeStringTemplate = getStringTemplateGroup().getInstanceOf("airlift/dao/DaoRange");

				daoRangeStringTemplate.setAttribute("findByRangeSql", databaseGenerator.generateFindThisRangeSql(_domainObjectModel, fieldName));
				daoRangeStringTemplate.setAttribute("rangeParameters", type + " lowerBound, " + type + " upperBound");

</textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<hr>
</td>
</tr>
</table>
</body>
</html>
